package com.xuzm.netty.dto;

import lombok.Data;

import java.util.Date;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;

@Data
public class RunDataDto {
    /**客服端地址（ip+端口）*/
    private String addr;
    /**船的唯一标识*/
    private String mmsi;
    /**当天数据量*/
    private AtomicInteger dayDataCount = new AtomicInteger(0);
    /**当天有效数据量*/
    private AtomicInteger dayValidDataCount = new AtomicInteger(0);
    /**连接时间*/
    private Date connectTime;
    /**最后发出数据时间*/
    private Date lastSendDataTime;
    /**结束时间*/
    private Date closeTime;
    /**当前状态，0=离线，1=在线*/
    private Integer currentStatus;

    public enum Status{
        DOWN_LINE(0),
        ON_LINE(1);

        private Integer code;
        Status(Integer code) {
            this.code = code;
        }

        public Integer getCode() {
            return code;
        }
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        RunDataDto that = (RunDataDto) o;
        return Objects.equals(mmsi, that.mmsi);
    }

    @Override
    public int hashCode() {
        return Objects.hash(mmsi);
    }
}
